{include file="public/header"}
{load href="/public/static/Content/ThemesBusiness/ListPage.css"}
<style>
    .datagrid-view {
        overflow-x: scroll;
    }
</style>
<script src="/public/static/Scripts/common-binder-list-view.js"></script>
<script src="/public/static/Scripts/ScriptsEasyui/datagrid-filter.js"></script>

<script type="text/javascript">

    var data = null;
    $(function () {
      
      $('#gridList').datagrid({
          //  url:'/admin/card/list.html?ajax=1',
          remoteSort: false,
          sortOrder: 'desc',
          //sortName: 'name',

      });
  });
    // var gridListHandler = new listGridHandler(data, 'gridListHandler', 'gridList');
    // gridListHandler.formName = '商品';
    // gridListHandler.enableFilter = false;
    // $(function () {
    //     gridListHandler.bindFilter($('#gridList'));
    // });
    // gridListHandler.getNewUrl = function (id) {
    //     return '/admin/good/add';
    // };
    // /* gridListHandler.getEditUrl = function(recordID) {
    //      return '/admin/usergroup/edit/' + recordID;
    //  };*/

    // gridListHandler.getDeleteUrl = function (recordID) {
    //     return '/admin/good/del/' + recordID;

    // };

    function formatState(val, row, index) {
        if (row.status == 0) {
            val = '<span style="display:inline-block;background-color:#abbac3;color:#fff;padding:1px 5px;">' +
                '正常' +
                '</span>';
        }
        else {
            val = '<span style="display:inline-block;background-color:#d15b47;color:#fff;padding:1px 5px;">' +
                '停用' +
                '</span>';
        }
        return val;
    }

    function showList(id) {
        if (id <= 0) {
            $.messager.alert('提示', "没有ID", 'info');
            return 0;
        } else {
            window.showBusinessForm("详情", '/admin/fix/details.html?id=' + id);
        }


    }

    function addStatus(id, checkstatus) {
        if (id <= 0) {
            $.messager.alert('提示', "操作失败", 'info');
            return 0;
        }

        $.messager.confirm('提示', '确定进行操作吗？', function (r) {
            if (r) {
                $.ajax({
                    type: "POST",
                    url: 'add_status.html?id=' + id + '&checkstatus=' + checkstatus,
                })
                    .success(function (result) {
                        if (result.status > 0) {
                            $.messager.alert('提示', result.msg, "info");
                            window.location.reload();
                        } else {
                            $.messager.alert('提示', result.msg, "error");
                        }
                    })
                    .error(function (result) {
                        var message = "很抱歉，操作出现异常！请联系管理员。";
                        if (result) {
                            if (result.responseJSON && result.responseJSON.ExceptionMessage) {
                                message = result.responseJSON.ExceptionMessage;
                            }
                            else if (result.responseText) {
                                message = result.responseText;
                            }
                        }

                        $.messager.alert('错误', message.replace("-10", ""), 'error');
                    });
            }
        });

    }
    function showimg(val, row, index) {
        if (row.img == '') {
            val = '无';
        }else{
            val = '<a target="_blank" href="/uploads/img/'+ row.img +'">点击查看'+'</a>';
        }
        return val;
    }
    function showvideo(val, row, index) {
        if (row.video == '') {
            val = '无';
        } else {
            val = '<a target="_blank" href="/uploads/video/'+ row.video +'">点击查看'+'</a>';
        }
        return val;
    }

    function formatAction(val, row, index) {
        val = '<u><a href="#" onclick="showList(' + row.id + ')">' + row.fixnum + '</a></u>';
        return val;
    }

    function daochu() {
        var stime = $('#stime').datebox('getValue');
        var etime = $('#etime').datebox('getValue');
        if (stime != "" && etime == "") {
            $.messager.alert('提示', '请先输入结束时间', 'error');
            return false;
        }
        if (etime != '' && stime == '') {
            $.messager.alert('提示', '请先输入起始时间', 'error');
            return false;
        }
        
        location.href = "daochu.html?stime=" + stime + "&etime=" + etime;
    }
    //审核1-1
    function shenheAction(val, row, index) {
        val = '{eq name="power.activate" value="true"}  <a href="javascript:;" onclick="shenhe(' + row.id + ')" title="审核">审核</a>{/eq}';
        return val;
    }

    //审核1-2
    function shenhe(id) {
        window.showBusinessForm("审核", '/admin/fixshenhe/shenhe.html?id=' + id);
    }


</script>

<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',border:false" class="grid-toolbar-panel" id="gridList_ToolBar">
        <a href="#" id="news" class="easyui-linkbutton grid-toolbar-button"></a>
        <span style="padding-left:50px;">按条件导出：
            <!-- <select class="easyui-combobox" name="state" id="GroupID" data-options="required:true,tipPosition:'right',"
                style="width:152px;">
                <option value="0">按出库日期</option>
                <option value='1'>按入库日期</option>
            </select> -->
            起始时间：<input id="stime" type="text" class="easyui-datebox" style="width:100px;" value="">-
            结束时间：<input id="etime" type="text" class="easyui-datebox" style="width:100px;" value="">
            {eq name="power.export" value="true"}
            <a href="#" style="padding-left:10px;" onclick="daochu()">导出数据</a>
            {/eq}
        </span>

    </div>
    <div data-options="region:'center',border:false">
        <table id="gridList" class="easyui-datagrid" exusagetype="MultiSelection"
            data-options="striped: true,singleSelect: true,collapsible: true,rownumbers: true,fit: true,pagination:true,pageSize:15,pageList:[10,15,20]"
            url="/admin/fixshenhe/index.html?ajax=1">
            <thead data-options="frozen:true">
                <tr>
                    <th data-options="field:'good_name',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">产品名称</span></th>
                    <th data-options="field:'tagslogs_sn',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">序列号</span></th>
                    <th data-options="field:'tagslogs_sn1',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">关联序列号</span></th>
                    <th data-options="field:'shenhe',width:60,halign:'center',align:'center',formatter:shenheAction,sortable:true">审核
                    </th>
                    <th data-options="field:'addtime',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">出库日期</span></th>
                    <th data-options="field:'outtime',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">入库日期</span></th>
                    <th data-options="field:'cause',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">故障原因</span></th>
                    <th data-options="field:'project',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">维修项目</span></th>
                    <th data-options="field:'price',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">维修费用</span></th>
                    <th data-options="field:'date',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">维修时间</span></th>
                    <th data-options="field:'personnel',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">维修人员</span></th>
                    <th data-options="field:'fixwhere',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">维修来源</span></th>
                    <th data-options="field:'id',width:100,halign:'center',align:'center',formatter:showimg">图片
                    </th>
                    <th data-options="field:'video',width:100,halign:'center',align:'center',formatter:showvideo">视频
                    </th>
                    <th data-options="field:'danwei',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">送检单位</span></th>
                    <th data-options="field:'contacts',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">联系人</span></th>
                    <th data-options="field:'telphone',halign:'center',align:'left',width:150,sortable:true"><span
                            class="grid-header-sortable">联系电话</span></th>
                    
                </tr>
            </thead>

        </table>

    </div>
</div>
{include file="public/footer"/}